Introduction
Purpose
The purpose of the present document is to provide an installation guide and to describe the mode of operation of the SPICE Archive Generation pipeline (ARCGEN) and a summary of its main functionalities. After reading this document the user should be able to install, operate with and fully understand the software package.
Running ARCGEN in a nutshell
-
Obtain ARCGEN from BitBucket: https://repos.cosmos.esa.int/socci/projects/SPICE/repos/arcgen/
-
Install from top level directory with "pip3 install -e ."
-
Generate an ARCGEN configuration file as from arcgen/arcgen/test/exomarsrsp.json
-
Generate the appropriate directory structure as derived from the configuration file
-
Obtain and install your SPICE Kernel Dataset: https://repos.cosmos.esa.int/socci/projects/SPICE_KERNELS
-
Run with "arcgen yourconfig.json"
Overview
Auxiliary data are those that help scientists and engineers to determine the location and orientation of the spacecraft, when and how an instrument was acquiring scientific data. These data also help to determine what other relevant events were occurring on the spacecraft or ground that might affect the interpretation of the scientific observation or the S/C systems performance. Software applications are required to know what were the location, size, shape and orientation of the observed target in addition to these auxiliary data. Almost all NASA and ESA planetary missions have embraced the use of the SPICE system for ancillary data archiving and for science data analysis. Although the Flight Dynamics Division provides software to read the position and orientation files of the orbiters, most of the Principal Investigators (PI) have pointed out their interest in having all the auxiliary data distributed in SPICE format.
The ESA SPICE Service (ESS) of the Cross Mission Support Office is responsible for the generation of the PDS3 and PDS4 SPICE Archives for the applicable ESA missions. ARCGEN supports the ESS engineers and selected users such as the ExoMarsRSP ROCC to generate these PDS3 data sets and PDS4 bundles.
Applicable and Reference Documents
ARCGEN is based on different technologies, in particular most of the code is written in Python. Other technologies such as JSON are used, being familiar with those technology will certainly facilitate the usage of ARCGEN.
Applicable Documents
|
ID |
Title |
Reference |
|
AD-PSA |
PSA PDS4 Archiving Guide |
|
|
AD-PR4 |
PDS4 Bundle Generation Procedure |
|
|
AD-RP3 |
PDS4 Data Set Generation Procedure |
|
|
AD-PYP |
Packaging and Distributing Projects |
https://packaging.python.org/tutorials/distributing-packages/ |
|
AD-JSN |
Introducing JSON |
|
|
AD-BBT |
Bitbucket |
Reference Documents
|
ID |
Title |
Reference |
|
RD-SPY |
Annex et al., (2020). SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit. Journal of Open Source Software, 5(46), 2050 |
|
|
RD-VAL |
NASA PDS Validate Tool |
Terms, Definitions and Abbreviated Terms
|
Acronym |
Name |
|
OEM |
Orbit Ephemeris Message |
|
AEM |
Attitude Ephemeris Message |
|
TCP |
Time Correlation Packets |
|
JSON |
JavaScript Object Notation |
|
EM16 |
ExoMars2016 |
|
BC |
BepiColombo |
|
PSA |
Planetary Science Archive |
|
PDS |
NASA Planetary Data System |
|
DVal |
PSA PDS3 Data Validation Tool |
|
SOLO |
Solar Orbiter |
|
EMRSP |
ExoMarsRSP |
|
JUICE |
Jupiter Icy Moons Explorer |
|
MEX |
Mars Express |
|
VEX |
Venus Express |
|
FDy |
Flight Dynamics |
|
ROCC |
ExoMars Rover Operations Center |
|
SKD |
SPICE Kernel Dataset |
|
SGS |
Science Ground Segment |
Software Overview
ARCGEN consists on a set of Python based scripts devoted to the Archiving of SPICE Kernel Data Sets following the NASA Planetary Data System Standards (PDS3 and PDS4). It is a semi-automated package used to generate most of the files which have to be present inside a Data Set (PDS3) or Bundle (PDS4) based on the files included in the SKD. It includes validating functionalities which should be used for consistency checks after the execution of the pipeline.
Installation
Hardware and Software requirements
ARCGEN is a Python 3.6.x package that uses a set of standard Python packages and the SpiceyPy package.
ARCGEN is designed to work with UNIX systems namely with Linux and with MacOS. The hardware requirements are minimal and any modern computer/server will suffice. The software is able to run for example in a minimal CentOS 7 Virtual Machine:
-
Architecture: x86_64 (64 bits)
-
Memory: 1GB/logical CPU
-
Disk space: 10GB
Nevertheless it is recommended to allocate more resources for ARCGEN to run appropriately, the "Regression Tests" section includes further information on resource allocation and expected performances.
The software requirements are the following:
-
Python 3.6 or higher
-
Python packages:
-
numpy >= 1.8.0
-
spiceypy
-
-
Git (possibly, for the obtention of SPICE Kernel Datasets)
Obtaining the Software
Installing the source code
The source code of ARCGEN is under configuration control with Git. The BitBucket repository that hosts the code is the following: https://repos.cosmos.esa.int/socci/projects/SPICE/repos/arcgen/browse, since this is a private repository access might not be granted, if so please contact the author of this document. Alternatively the source code can be obtained under request from spice@sciops.esa.int.
If the user installs ARCGEN from its source code it is recommended to use PiPy to do so (taking advantage of the Python setup file), in order to do so using the Terminal go to the top level ARCGEN directory, arcgen and type:
pip install [--user] -e .Please note that the --user parameter is optional; if you are using your user Python installation it needs to be indicated.
Once installed, you will be able to run ARCGEN anywhere in your computer.
Source Code structure
A brief overview of the code structure for ARCGEN is useful for its installation, configuration and usage:
|
ARCGEN Package top level structure |
||||
|
aescalante |
|
VEX and MEX example config files. |
||
|
bgrieger |
ROS example config file. |
|||
|
sandbox |
Some routines for various checks. |
|||
|
README.md |
Readme file (as per any other Python package). |
|||
|
rvalles |
VEX test example config files. |
|||
|
docs |
PDS Standars Documentation |
|||
|
setup.py |
Setup Python routine. |
|||
|
arcgen |
Package directory. |
|||
|
|
command_line.py |
|
Main function called when invoking ARCGEN. |
|
|
|
classes |
Directory that contains Python source code classes. |
||
|
|
config |
Directory that contains the mission-specific developer configuration items for ARCGEN. |
||
|
|
etc |
Directory that contains different templates used by ARCGEN (mostly the ones used by the FORTRAN utilities). |
||
|
|
utils |
|
Directory that contains Python source code utility functions. |
|
|
|
|
checkText.py |
Script used to check some PDS3 format consistencies, end of lines, line lengths and label keywords |
|
|
|
tests |
|
Directory that contains the tests performed for ARCGEN. |
|
Configuration
The next step to use ARCGEN is to configure it.
The configuration has to be edited and prepared by the user. It consists of a JSON file and an example from the test directory of ARCGEN can be used as baseline (arcgen/arcgen/test/exomarsrsp.json). Any name can be provided to the configuration file, the file extension has to be *.json. The configuration file will determine the directory structure that you need to setup for ARCGEN. The recommendation is to create a directory out of the ARCGEN directory structure and to create one per intended ARCGEN execution/project.
The following table describes all the available configuration items (please note that all the items are strings):
|
Key |
Value(s) |
Description |
PDS |
|
name |
ARCGEN Configuration File |
Description of the JSON file |
3,4 |
|
xml_model |
XML Model |
PDS XML Model (typically fixed) |
4 |
|
schema_location |
Schema Location |
PDS Schema Location (typically fixed) |
4 |
|
information_model_version |
Information Model Version |
PDS Information Model Version (can change) |
4 |
|
bundle_directory |
Bundle/Data Set output directory |
Directory where ARCGEN puts the generated archive |
3,4 |
|
kernels_directory |
SKD directory |
Directory where ARCGEN looks for Kernels as input |
3,4 |
|
increment |
Archive last increment |
Existing version of the archive to increment |
3,4 |
|
increment_stop |
Increment Stop date |
Stop date for the new increment |
3,4 |
|
mission_name |
|
Name of the mission, has to be one of the provided in the list. (corresponds to the name of the SKDs replacing the dashes). |
3,4 |
|
mission_accronym |
|
Mission accronym, has to be one of the provided in the list. |
3,4 |
|
dataset |
Data Set name |
Name of the Data Set |
3 |
|
dataset_name |
Data Set descriptive name |
Data Set descriptive name |
3 |
|
volume_id |
Volume Identifier |
Identifier of the Archive Volume |
3 |
|
spacecraft |
Spacecraft Name |
Name of the Spacecraft |
3,4 |
|
target |
Target Name |
Name of the Target (Mars, Venus, Mercury,...) |
3,4 |
|
mission_start |
Start UTC date |
Start date of the archive (YYYY-MM-DD) |
3,4 |
|
mission_stop |
Stop UTC date |
Stop date of the archive (YYYY-MM-DD) |
3,4 |
|
secondary_spacecrafts |
Secondary spacecrafts names |
Name of any secondary spacecraft (e.g. PHILAE) |
3,4 |
|
secondary_targets |
Secondary target names |
Name of any secondary target (e.g. DEIMOS, PHOBOS) |
3,4 |
|
metakernel |
Metakernel Path |
SKD Metakernel used for archive generation |
3,4 |
|
pds |
PDS Version
|
Version of PDS format |
3,4 |
|
author |
Author name |
Nome of the author that generates the archive |
3,4 |
|
producer_name |
Archive producer name |
Name of the producer of the particular increment |
4 |
|
producer_email |
Archive producer email |
Email of the producer of the particular increment |
4 |
|
producer_phone |
Archive producer phone |
Phone of the producer of the particular increment |
4 |
|
doi |
Digital Object Identifier |
Digital Object Identifier of the Bundle |
4 |
|
lsk_pattern |
LSK Pattern |
Used for label-only generation for PDS4 Kernels |
4 |
|
sclk_pattern |
SCLK Pattern |
Used for label-only generation for PDS4 Kernels |
4 |
|
fk_pattern |
FK Pattern |
Used for label-only generation for PDS4 Kernels |
4 |
Once the configuration file has been generated it can be placed anywhere in your computer, it is recommended to put it in the same directory level as where you will have the directory structure as a result of the ARCGEN execution. What follows is an example of an ARCGEN configuration file:
{ "name": "ARCGEN Configuration File", "pds": "4", "xml_model": "http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1D00.sch", "schema_location":"http://pds.nasa.gov/pds4/pds/v1 http://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_1D00.xsd", "information_model_version":"1.13.0.0", "kernels_directory": "/Users/mcosta/SPICE/ExoMarsRSP/kernels", "bundle_directory": "/Users/mcosta/arcgen/arcgen/tests/emrsp_spice", "increment":"", "mission_name": "ExoMars RSP", "author": "Marc Costa Sitja", "mission_accronym": "emrsp", "spacecraft": "ExoMars RSP Rover", "secondary_spacecrafts": "ExoMars RSP Surface Platform, ExoMars RSP Carrier Module", "secondary_targets":"", "target": "Mars", "mission_start": "2022-07-01T00:00:00.000Z", "mission_stop":"2030-07-01T00:00:00.000Z", "increment_stop": "2022-12-31T00:00:00.000Z", "metakernel": "", "lsk_pattern": "/Users/mcosta/adcsng/adcsng/tests/emrsp/ker_dir/lsk/naif????.tls", "sclk_pattern": "/Users/mcosta/adcsng/adcsng/tests/emrsp/ker_dir/sclk/emrsp_rm_test_ret_*_v???.tsc", "fk_pattern": "/Users/mcosta/adcsng/adcsng/tests/emrsp/ker_dir/fk/emrsp_rm_v???.tf", "producer_name": "Marc Costa Sitja", "producer_email": "esa_spice@sciops.esa.int", "producer_phone":"(+34) 91-8131-457", "doi":"10.5270/esa-kfjsoi9"}If we consider a Mars-Express configuration file, after an execution we could have a directory structure as follows:
mex.jsonMEX-E-M-SPICE-6-V2.0|-- AAREADME.TXT|-- CATALOG |-- DATA (ARCGEN will put kernels with labels here)|-- DOCUMENT|-- ERRATA.TXT|-- EXTRAS| |-- MK| '-- ORBNUM|-- INDEX'-- VOLDESC.CATkernels|-- spk|-- ck:'-- mk
Kernels and Output directories requirements
You need a working SPICE Kernel Dataset to run ARCGEN
It is important to note that you need a local copy of a working SKD in order to execute ARCGEN. This document does not intend to provide you a detailed explanation on how to obtain the latest version of a given SKD, instead we recommend you to read the information in the following page: https://www.cosmos.esa.int/web/spice/data or the ESS Procedure to operate ARCGEN to generate a PDS4 Bundle [AD-PR4] or a PDS3 Dataset [AD-PR3].
What is important to note though is that you will need to have a working SKD. In order to check that you do, we recommend you to use a SPICE utility such as BRIEF on the MK in order to ensure that the SKD is properly set up.
Executing ARCGEN
In order to execute ARCGEN you only need to type the command: arcgen, the command usage is as follows:
arcgen [-h] [-e] [-l] [-t] CONFIG [CONFIG ...]Indicating the configuration file path is mandatory, the options are displayed by the -h or --help options:
ARCGEN -- Version 1.0.0, SPICE PDS3/PDS4 Archive Generation Pipeline ARCGEN is the command-line utility program that generates PDS4 Bundles and PDS3 Datasets for SPICE Kernel Datasets. Source and documentation are available here: https://repos.cosmos.esa.int/socci/projects/SPICE/repos/arcgenpositional arguments: CONFIG Mission specific JSON configuration fileoptional arguments: -h, --help show this help message and exit -e, --labels Execute ARCGEN to generate labels only -l, --log Prompt log during execution -t, --transfer Execute ARCGEN to generate PSA transfer manifest __ __ __ __ __ __ ___ __ ___ __ __ ___ /__\ /__` '__\ /__` |__) | / ` |__ /__` |__ |__) \ / | / ` |__ \__, .__/ \__/ .__/ | | \__, |___ .__/ |___ | \ \/ | \__, |___ spice@sciops.esa.int http://spice.esac.esa.intPlease note that if you do not use the optional argument -l or --log you will not be prompted the log of the execution. Error messages prior to the log creation might be shown though.
Once ARCGEN is executed, in a nutshell it checks the kernels directory for input SKD. The kernel grammar is used to include/exclude kernels from the SKD into the generated data set/bundle and generate the metakernel of the archive. If a previous archive is provided with "increment" keyword, ARCGEN searches for previous files to be included in the current increment. Finally, the index file is generated listing the files in the archive.
In the case of generating a PDS3 Data Set, after running the pipeline the user has to manually update several files of the archive which include but are not limited to:
-
AAREADME.TXT
-
CATALOG
-
DOCUMENT
-
ERRATA.TXT
-
VOLDESC.CAT
Validating PDS3 Data Sets
It is also a good practice to run additional checks on the generated archive to make sure the files have been generated correctly, the format is adequate and the PDS standards have been followed properly. In the directory arcgen/arcgen/utils, the python script checkText.py can be used to check some PDS3 format consistencies, end of lines, line lengths and label keywords.
In addition the legacy PSA tool DVal tool may be used as well to perform some checks on the Data Set. Download the Data Validator command line tool from ftp://ssols01.esac.esa.int/pub/software/DValNG/index.html#advanced. Unpack the gzipped tar file. Executables are in DatasetValidator/bin. Before running any checks, run ConfigSynchronizer. Calling GrammarChecker without arguments lists possible options and parameters. In order to create a log file listing the issues found by the tool, GrammarChecker as:
|
DatasetValidator/bin/GrammarChecker -f grammarcheckerlog.txt -i ARCGEN_OUTPUT |
It will find issues related to incorrect line endings, non ASCII characters or incorrect label structure.
For more information on how to validate a PDS3 data set contact the ESS.
Validating PDS4 Bundles
For PDS4 Bundles running the PDS Validate Tool is recommended [RD-VAL].
The context products required for each mission are available in the arcgen/arcgen/config directory. An example of how to execute the validate tool is available at arcgen/arcgen/tests/test_exomarsrsp_validate.sh
For more information on how to validate a PDS4 bundle contact the ESS.
ARCGEN Python packages
ARCGEN does not have any non-Python internal executables, instead, ARCGEN makes use of the non-standard Python package SpiceyPy [RD-SPY].
7. Logging
ARCGEN provides multiple options for the logging process, the logging is provided via:
-
Prompted Log in the screen if -l or --log optional argument is provided
-
Log file per ARCGEN execution (to be implemented)
Please note that logging is still not fully implemented.
Exception and Error handling
ARCGEN has a limited but concise amount of exception and error handling taking advantages of the possibilities of Python and limited by the error handling of CSPICE (C version of SPICE). Wherever possible ARCGEN will provide enough information for the developer to fix the issue.
ARCGEN exit codes
When a command finishes execution, it returns an exit code. The exit code is not displayed on the command line screen by default. To examine the exit code, you need to examine a special variable, "$?", that can be displayed with the command "echo $?". In bash in general the exit status is 0 if the command succeeded, and 1 if failed. The exit codes for ARCGEN are as follows:
-
Run successfully: 0
-
Dry-run (without input): 0
-
Display usage 'adcsng -h': 0
-
Run with errors: 1
-
Executed with wrong arguments: 2
Regression Tests
ARCGEN incorporates a number of regression tests that can be run from the development environment by the ESS. It is recommended that the ARCGEN user also runs these tests before working with ARCGEN in her/his environment.
The tests can be run in any Python test environment and after ADCSng is installed they can also be run with:
python3 arcgen/tests/test_regression.py
Currently the regression tests are performed for both ExoMars 2016 and Venus-Express mission's archives. In the case of ExoMars 2016 there are defined two tests, one for the first PDS4 bundle generation and other for the first PDS4 bundle increment done by ARCGEN. In the case of Venus-Express there is only one test, and it's purpose is to validate the first PDS3 dataset done by ARCGEN. There are still some tests that need to be included, e.g.: The second PDS4 bundle increment for EM16, first and second increments for PDS3 dataset of VEX and tests for other missions like EMRSP, MEX, ROSETTA, etc.
The directory structure is the same for each test (we consider a test as the result of an execution of ARCGEN) and contains a number of files and directories to be able to carry out the test. For each test there is one directory for the kernels used for the execution (kernels), a directory for the generated dataset(gen), a directory for the dataset to be validated against the generated ones (val). The resulting directory structure is as follows (ExoMars2015 example):
.|-- em16_v001.json <= ARCGEN Configuration file for this test|-- gen <= Folder used as output for the dataset, after running the test its contents shall match the ones in val folder.|-- kernels <= SPICE Kernel Dataset to be used by ARCGEN to run the test| |-- ck| |-- dsk| |-- fk| |-- ik| |-- lsk| |-- mk| |-- pck| |-- sclk| |-- spk|-- val |-- bundle <= Bundle to be used as reference for validation of the one generated by the execution of the test. | |-- bundle_em16_spice_v001.xml | |-- document | | |-- collection_document_inventory_v001.csv | | |-- collection_document_v001.xml | | |-- spiceds_v001.html | | |-- spiceds_v001.xml | |-- readme.txt | |-- spice_kernels | |-- collection_spice_kernels_inventory_v001.csv | |-- collection_spice_kernels_v001.xml | |-- ck | |-- fk | |-- ik | |-- lsk | |-- mk | |-- pck | |-- sclk | |-- spk |-- em16_spice.transfer <= Transfer file to be used as reference |-- mk_report.txt <= SKD report file to be used as reference for the validation of the archived SKD
Regression tests content
Currently there are only three tests defined for ARCGEN. More tests shall be implemented.
-
test_em16_v001: This test validates the first PDS4 bundle generated by ARCGEN for ExoMars 2016
-
test_em16_v002: This test validates the first PDS4 bundle increment done by ARCGEN for ExoMars 2016
-
test_vex_v002: This test validates the first PDS3 dataset generated by ARCGEN for Venus-Express. Note that name is .._v002 but this is just because it uses as reference the version 2 of the VEX dataset (VEX-E-V-SPICE-6-V2.0), it's not a dataset increment.
Each of these tests are implemented in a Python class that inherits the base class named "ARCGENTest", that is the responsible for performing the tests with the inputs of the child class.
The steps performed by the ARCGENTest class are:
-
Clean-up possible data from previous executions
-
Prepare test environment
-
Perform checks on given ARCGEN configuration file
-
Run ARCGEN with the configuration file
-
In case of a PDS4 test, create the transfer file
-
Generate the report from the given meta-kernel
-
Check that "gen" and "val" folders have the same contents
-
Clean-up execution data
An HTML test report is generated after every test in the 'reports' directory.
Tests performances
Here we show a screenshot with the results of executing the regression tests. Note that the tests are run in about 1,5 secs.